package net.phoenix.repository.data;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 
 * @author lixf
 * 
 */
public class NodeTypeData extends BasicData {

	/**
	 * 
	 */
	private static final long serialVersionUID = 939782964819188278L;
	private String name;
	private String description;
	private String[] superTypes = new String[0];
	private Date createTime;
	private boolean isAbstract=false;
	private boolean mixin=false;
	private boolean hasOrderableChildNodes=true;
	private boolean queryable=true;
	private String primaryItemName;

	private List<PropertyDefinitionData> properties = new ArrayList<PropertyDefinitionData>();
	private List<NodeDefinitionData> children = new ArrayList<NodeDefinitionData>();

	

	public void setDescription(String description) {
		this.description = description;
	}

	public void setSuperTypeList(String types) {
		this.superTypes = types.split("[\\,\\;\\s]");
	}

	public String[] getSuperTypes() {
		return this.superTypes;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {

		return description;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public String getName() {
		return name;
	}

	/**
	 * @return the properties
	 */
	public PropertyDefinitionData[] getPropertyDefinitions() {
		return properties.toArray(new PropertyDefinitionData[this.properties
				.size()]);
	}

	/**
	 * @param properties
	 *            the properties to set
	 */
	public void addPropertyDefinition(PropertyDefinitionData property) {
		this.properties.add(property);
	}

	/**
	 * @return the properties
	 */
	public NodeDefinitionData[] getNodeDefinitions() {
		return children.toArray(new NodeDefinitionData[this.children.size()]);
	}

	/**
	 * @param properties
	 *            the properties to set
	 */
	public void addNodeDefinition(NodeDefinitionData child) {
		this.children.add(child);
	}

	public boolean isAbstract() {
		return isAbstract;
	}

	public void setAbstract(boolean isAbstract) {
		this.isAbstract = isAbstract;
	}

	public boolean isMixin() {
		return mixin;
	}

	public void setMixin(boolean mixin) {
		this.mixin = mixin;
	}

	public boolean isHasOrderableChildNodes() {
		return hasOrderableChildNodes;
	}

	public void setHasOrderableChildNodes(boolean hasOrderableChildNodes) {
		this.hasOrderableChildNodes = hasOrderableChildNodes;
	}

	public boolean isQueryable() {
		return queryable;
	}

	public void setQueryable(boolean queryable) {
		this.queryable = queryable;
	}

	public String getPrimaryItemName() {
		return primaryItemName;
	}

	public void setPrimaryItemName(String primaryItemName) {
		this.primaryItemName = primaryItemName;
	}

}
